package com.example.internetplus.result;





import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
     String msg;//消息
     Integer code;//消息码
     T data;//数据
     private Result(String msg,Integer code){
         this.code =code;
         this.msg = msg;
     }
     public static <T>Result<T> success(String message,Integer code, T data){
         return new Result(message,code,data);//成功返回
     }
     public static Result success(String message,Integer code){
            return new Result(message,code);//成功返回
        }
     public static Result defeat(String message , Integer code){
             return new Result(message,code);//失败返回
        }
    public static <T>Result<T> defeat(String message , Integer code , T data){
        return new Result(message,code,data);//失败返回
    }
}
